<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>查询统计管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	initVaccName(inventoryDetail.companyCode,inventoryDetail.vaccineId);
	initVaccCompanyName(inventoryDetail.companyCode);
	$(".vaccineCompany").change(function(){
		var vaccId = $(this).val();
		initCompanyName($(this).val());
		if(vaccId == ""){
			initVaccCompanyName("");
		}
	});
});
var inventoryDetail = JSON.parse('${fns:toJson(inventoryDetail)}');
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
   	return false;
}
function down(){
	top.$.jBox.confirm("确认要导出疫苗出入库流向信息数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","${ctx}/area/vaccinate/vaccFlowShowExport");
			$("#searchForm").submit();
		}
		$("#searchForm").attr("action","${ctx}/area/vaccinate/vaccFlowShow");
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
}
</script>
<style type="text/css">
	.minWidth {
		min-width: 177px;
	}	
	#contentTable td ,#contentTable th{
		text-align: center;
	}
	#contentTable {
	    padding:1px 4px;
	    width: 99%;
	}
	#contentTable tbody tr td{
		font-size: 13px;
	}
	.w70 {
		width: 100px;
		min-width: 70px;
    }
</style>
</head>
<body>
	<form:form id="searchForm" modelAttribute="inventoryDetail" action="${ctx}/area/vaccinate/vaccFlowShow" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="grade" name="grade" type="hidden" value="${fn:join(inventoryDetail.grade,',')}"/>
		<input id="storeCode" name="storeCode" type="hidden" value="${inventoryDetail.storeCode}"/>
		<input id="vaccineId" name="vaccineId" type="hidden" value="${inventoryDetail.vaccineId}"/>
		<input id="companyCode" name="companyCode" type="hidden" value="${inventoryDetail.companyCode}"/>
		<input id="batchNo" name="batchNo" type="hidden" value="${inventoryDetail.batchNo}"/>
		<input id="beginDate" name="beginDate" type="hidden" value="<fmt:formatDate value="${inventoryDetail.beginDate}" pattern="yyyy-MM-dd"/>"/>
		<input id="endDate" name="endDate" type="hidden" value="<fmt:formatDate value="${inventoryDetail.endDate}" pattern="yyyy-MM-dd"/>"/>
		<table class="table table-bordered">
			<tr>
			    <th>疫苗名称:</th>
				<td>
					<form:select path="vaccineId" class="span2 minWidth vaccineCompany" readonly="true" disabled="true">
						<form:option value="" label="--请选择--"/>
					</form:select>
				</td>
				<th>生产企业：</th>
				<td>
					<form:select path="companyCode" class="span2 minWidth changeCompany vaccCompanyName" readonly="true" disabled="true">
					    <form:option value="" label="--请选择--"/> 
					</form:select>
				</td>
				<th>批号</th>
				<td>
					<form:input path="batchNo" class="span2 minWidth" readonly="true" disabled="true"/>
				</td>
			</tr>
			<tr>
			</tr>
			<tr>
				<th>出入库起始日期</th>
				<td>
					<input name="beginDate" id ="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${inventoryDetail.beginDate}" pattern="yyyy-MM-dd"/>" readonly="readonly" disabled
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				</td>
				<th>出入库截止日期</th>
				<td colspan="3">
					<input name="endDate" id ="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${inventoryDetail.endDate}" pattern="yyyy-MM-dd"/>" readonly="readonly" disabled
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				</td>
			</tr>
		</table>
	    <button onclick="down()" class="btn btn-primary" type="button">导出</button>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			    <th>编号</th>
				<th>疫苗名称</th>
				<th class="w70">生产企业</th>
				<th class="w70">规格</th>
				<th>批号</th>
				<th>疫苗属性</th>
				<th>出入库日期</th>
				<th>有效期</th>
				<th>出入库单号</th>
				<th>出入库类型</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>成本价</th>
				<th>出售价</th>
				<th>数量</th>
				<th>金额</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="details" begin="0" varStatus="status">
			<tr>
			    <td>
			        ${(page.pageNo-1)*page.pageSize+status.index+1 }
			    </td>
				<td>
				    ${details.vaccName}
				</td>
				<td>
				    ${details.companyName}
				</td>
				<td>
				    <c:if test="${details.batchType eq '2' }">
						${fns:getDictLabel(details.spec, 'syringe_spec', '')}
					</c:if>
					<c:if test="${details.batchType eq '1' }">
	                       ${details.dose},${details.doseType}<br>
	                       ${details.spec},${details.containerType}
					</c:if>
			    </td>
				<td>
				    ${details.batchNo}
					<c:if test="${not empty details.secondBatchno}">
				        <span title="(查询批号时不需要带入亚批号)" style="color: #2fa4e7;">-${details.secondBatchno}</span>
				    </c:if>
				</td>
				<td>
				    ${fns:getDictLabel(details.cType, 'bs_vaccine_type', '') }
				</td>
				<td>
				    <fmt:formatDate value="${details.inAndOutDate}" pattern="yyyy/MM/dd"/>
				</td>
				<td>
				    <fmt:formatDate value="${details.outBoundDate}" pattern="yyyy/MM/dd"/>
				</td>
				<td>
				    ${details.orderNo}
				</td>
				<td>
				    ${fns:getDictLabel(details.orderType,'bs_order_ordertype','')} <br>
				    ${fns:getDictLabel(details.orderStatus, 'bs_order_status', '') }
				</td>
				<td>
				    ${details.supplyorgName}
				</td>
				<td>
				    ${details.receiveorgName}
				</td>
				<td style = "text-align: right; padding-right: 10px">
				         ￥${details.orignprice}
				</td>
				<td style = "text-align: right; padding-right: 10px">
				         ￥${details.sellprice}
				</td>
				<td>
				    ${details.vaccNum}
				</td>
				<td style = "text-align: right; padding-right: 10px">
				    ￥${details.vaccNumAmount}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>